package yu.zhu.todo.pojo.vo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import yu.zhu.todo.pojo.TodoDto;

/**
 * @Author yuzhu
 * @Date 2020/11/11 18:35
 */
@Data
@Document("todo")
public class TodoMongoVo {

        @Id
        private  String id;
        private  String title;
        private Integer completed;

        public static TodoMongoVo convertDao(TodoDto todoDto){
                TodoMongoVo todoMongoVo = new TodoMongoVo();
                todoMongoVo.setId((String) todoDto.getId());
                todoMongoVo.setTitle(todoDto.getTitle());
                todoMongoVo.setCompleted(todoDto.getCompleted());
                return todoMongoVo;
        }

        public static TodoDto convtDao(TodoMongoVo mongoVo){
                TodoDto todoDto = new TodoDto();
                todoDto.setId(mongoVo.getId());
                todoDto.setTitle(mongoVo.getTitle());
                todoDto.setCompleted(mongoVo.getCompleted());
                return todoDto;
        }
}
